#include <iostream>

using namespace std;
class Mammal {
public:
	virtual void speak(){
		cout << "the speak() of Mammal is called." << endl;
	}
};

class Dog: public Mammal {
public:
	virtual void speak(){
		cout << "the speak() of Dog is called." << endl;
	}
};

class Pug: public Dog {
public:
	virtual void speak(){
		cout << "the speak() of Pug is called." << endl;
	}
};

void Talk(Mammal& m){
	 m.speak();
}

int main(int argc, char *argv[]) {
	Mammal m;
	Talk(m);
	
	Dog d;
	Talk(d);
	
	Pug p;
	Talk(p);
}